package com.league.zjxn.main.adapter

import android.widget.ImageView
import com.blankj.utilcode.util.ToastUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.league.zjxn.R
import com.league.zjxn.entity.MemberData
import com.league.zjxn.main.home.LeagueDetailsActivity
import com.module.lemlin.image.loadCenterImage

class LeagueMemberAdapter :
    BaseQuickAdapter<MemberData, BaseViewHolder>(R.layout.item_league_member) {
    init {
        setOnItemClickListener { _, _, position ->
            val itemData = getItem(position)
            LeagueDetailsActivity.openProject(memberData = itemData)
        }
    }

    override fun convert(holder: BaseViewHolder, item: MemberData) {
        holder.setText(R.id.tvLeagueMemberName, item.title)
            .getView<ImageView>(R.id.ivLeagueMemberImage).apply {
//                Glide.with(this)
//                    .load(item.logo)
//                    .into(this)
            }
            .loadCenterImage(item.logo)
    }
}